// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

// 云函数入口函数
exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext()
  let { groupName} = event
  var success = false
  var message = "打开活动失败"
  const db = cloud.database()
  var updeteResp = await db.collection('rules').where({
    typeId: 0
  }).update({
    data: {
      isActivityOpen: true,
    }
  }).then(res => {
    success = true
    message = "打开活动成功"
  }, error => {
    success = false
    message = "打开活动失败"
  })
  return {
    success: success,
    message: message
  }
}